<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
use App\Api\Rebate\Models\RebateMobile;
use Carbon\Carbon;

$factory->define(App\User::class, function (Faker\Generator $faker) {
    return [
        'name'           => $faker->name,
        'email'          => $faker->safeEmail,
        'password'       => bcrypt(str_random(10)),
        'remember_token' => str_random(10),
        'api_token'      => str_random(60),
        'status'         => 0,
    ];
});

$factory->define(RebateMobile::class, function (Faker\Generator $faker) {
    $rebate_start = Carbon::now()->startOfMonth()->addMonth($faker->numberBetween(-13, 0));
    return [
        'number'       => $faker->regexify('/1[3578][0-9]{9}/'),
        'amount'       => $faker->randomNumber(2),
        'sku'          => 'fake-sku',
        'title'        => '联通测试套餐',
        'city'         => '0535',
        'balance'      => $faker->numberBetween(-100, 100),
        'rebate_start' => $rebate_start->format('ym'),
        'rebate_end'   => $rebate_start->addMonth(12)->format('ym'),
    ];
});
